package com.cet.beanmap.controller;

import com.cet.beanmap.listener.Event;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: cet-practice
 * @description:
 * @author: 陈恩涛
 * @create: 2023-04-12 19:57
 **/

@Slf4j
@RestController
public class MyController {

    @Resource
    private ApplicationEventPublisher applicationEventPublisher;


    @GetMapping("/filter")
    public String getString() {
        return "hello filter";
    }

    @RequestMapping("/notice/{msg}")
    @ResponseBody
    public void notice(@PathVariable String msg){
        log.info("begin>>>>>");
        applicationEventPublisher.publishEvent(new Event(msg));
        log.info("end<<<<<<<");
    }
}
